#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    :  
# @function: 
# @version :


import threading


# 定义一个全局变量 线程切换
num = 0


def add_():
    global num
    for i in range(1000000):
        num += i


def sub_():
    global num
    for i in range(1000000):
        num -= i


t1 = threading.Thread(target=add_)
t2 = threading.Thread(target=sub_)

t1.start()
t2.start()

t1.join()
t2.join()

print(num)
